<template>
  <div>
    <h2>查 看 小 班 信 息</h2>
    <div class="info">
      <div class="left">
        <p>名称：{{ classes.className }}</p>
        <p>负责人电话：<input type="text" v-model="classes.classPhone" /></p>
        <p>负责区域：{{ classes.theArea.areaName }}</p>
        <p>地类：{{ classes.theArea.areaLandType }}</p>
        <p>创建时间：{{ classes.classDate }}</p>
      </div>
      <div class="right">
        <p>负责人：<input type="text" v-model="classes.classManager" /></p>
        <p>人员数量：{{ classes.classNum }}</p>
        <p>林种：{{ classes.theArea.areaForestType }}</p>
        <p>优势树种：{{ classes.theArea.areaTreeType }}</p>
      </div>
    </div>
    <el-row>
      <el-button plain @click="update()">修改</el-button>
    </el-row>
  </div>
</template>

<script>
export default {
  data() {
    return {
      classId: "",
      classes: "",
    };
  },
  methods: {
    async getClassInfo(classId) {
      let paramObj = { classId: classId };
      let info = await this.ajax.getSubmit("/api/class/get", paramObj);
      console.log(info);
      this.classes = info;
    },
    async update() {
      let paramObj = {
        classId: this.classId,
        classManager: this.classes.classManager,
        classPhone: this.classes.classPhone,
      };
      console.log(this.classId,this.classes.classManager,this.classes.classPhone);
      let info = await this.ajax.getSubmit("/api/class/update", paramObj);
      this.$router.push("/home/classes");
    },
  },
  created() {
    //console.log(this.$route.query.diseaseId);
    this.classId = this.$route.query.classId;
    this.getClassInfo(this.classId);
  },
};
</script>

<style>
</style>